/*
 * @Author: szx
 * @Date: 2022-03-28 14:49:33
 * @LastEditTime: 2022-03-28 15:20:42
 * @Description:
 * @FilePath: \leetcode\300-399\322\322_2.js
 */
/**
 * @param {number[]} coins
 * @param {number} amount
 * @return {number}
 */
var coinChange = function (coins, amount) {
    const dp = new Array(amount + 1).fill(0);
    for (let i = 1; i <= amount; i++) {
        for (let j of coins) {
            if (j < i) continue;
            dp[i] += dp[i - j] + 1;
        }
    }
    return dp[amount];
};
